function getTimeStr14(str) {
	if (str == '')
		return '';
	else if (str == null)
		return '';
	else if (typeof str == 'undefined')
		return '';
	else 
		return str.substring(0, 4) + '-' + str.substring(4, 6) + '-' + str.substring(6, 8) + '&nbsp;' + str.substring(8, 10) + ':' + str.substring(10, 12);
}
function getTimeStr8(str) {
	if (str == '')
		return '';
	else if (str == null)
		return '';
	else if (typeof str == 'undefined')
		return '';
	else 
		return str.substring(0, 4) + '-' + str.substring(4, 6) + '-' + str.substring(6, 8);
}
function getNullValue(str) {
	if (str == '')
		return '';
	else if (str == null)
		return '';
	else if (typeof str == 'undefined')
		return '';
	else 
		return str;
}
function getImageUrl() {
	var reg = new RegExp('[0-9]+[.]+[0-9]+[.]+[0-9]+[.]+[0-9]+');
	var r = window.location.hostname.match(reg);
	if (r != null) {
		r = 'http://10.2.15.189:5998/';
	} else {
		r = 'http://www.gytaobao.cn:5998/';
	}
	return r;
}
$.fn.getPageStr = function(p, r, c, f, v) {
    p = parseInt(p);
    r = parseInt(r);
    c = parseInt(c);
    f = typeof f == 'undefined' || f == '' ? 'turnPage' : f;
    var t = Math.ceil(c / r), s, e;
    if (p < 3) {
        s = 1;
        e = t < 5 ? t : 5;
    } else {
        s = p - 2 < 1 ? 1 : p - 2;
        if (p + 2 > t) {
            e = t;
            s = t - 4 < 1 ? 1 : t - 4;
        } else {
            e = p + 2;
        }
    }
    var r = '<nav>' +
    			/*'<span>总共<span class="num">' + c + '</span>项<span class="num">' + t + '</span>页&nbsp;&nbsp;&nbsp;当前是第<span class="num">' + p + '</span>页</span>' +*/
				'<ul class="pagination">' +
					'<li' + (p == 1 ? ' class="disabled"' : '') + '><a' + (p == 1 ? '' : ' onclick="' + f + '(' + 1 + ', \'' + v + '\')"') + '>首页</a></li>';
		    for (var i = s; i <= e; i++) {
		        r += '<li' + (p == i ? ' class="active"' : '') + '><a' + (p == i ? '' : ' onclick="' + f + '(' + i + ', \'' + v + '\')"') + '>' + i + '</a></li>';
		    }
                r += '<li' + (p == t ? ' class="disabled"' : '') + '><a' + (p == t ? '' : ' onclick="' + f + '(' + t + ', \'' + v + '\')"') + '>末页</a></li>' +
				'</ul>' +
			'</nav>';
    $(this).html(r);
};
function getDefaultImg(o) {
	o.find('img').each(function() {
		$(this).error(function() {
			$(this).attr('src', '/templates/common/img/default2.png');
		});
	});
}
function getTitleNoResStr() {
	return '<p class="noresult up"><i class="fa fa-unlink"></i></p>' +
			'<p class="noresult-tip up">暂无相关信息</p>';
}